using System;
using System.Security.Principal;


namespace Votations.NSurvey.Web.Security
{
	/// <summary>
	/// NSurveyIdentity abstraction of a nsurvey web administration's DNN user
	/// </summary>
	public class NSurveyDNNIdentity : INSurveyIdentity
	{
		/// <summary>
		/// Login name 
		/// </summary>
		public string Name
		{
			get { return _name; }
		}
		
		/// <summary>
		/// Id of the user in the database
		/// </summary>
		public int UserId
		{
			get { return _userId; }
		}

		public string AuthenticationType
		{
			get { return "NSurveyDNNAuthentication"; }
		}

		public bool IsAuthenticated
		{
			get { return _isAuthenticated; }
		}

		public bool IsAdmin
		{
			get { return _isAdmin; }
		}

		public bool HasAllSurveyAccess
		{
			get { return _hasAllSurveyAccess; }
		}

		public NSurveyDNNIdentity(string name, int userId, 
			bool isAdmin, bool hasAllSurveyAccess, bool isAuthenticated)
		{
			_name = name;
			_userId = userId;
			_isAdmin = isAdmin;
			_hasAllSurveyAccess = hasAllSurveyAccess;
			_isAuthenticated = isAuthenticated; 
		}

		bool _isAdmin = false,
			 _hasAllSurveyAccess = false;

		bool _isAuthenticated = false;
		int _userId;
		string _name;
	}
}
